import 'package:json_annotation/json_annotation.dart';

part 'base_response.g.dart';

@JsonSerializable(genericArgumentFactories: true)
class BaseResponse<T> {
  BaseResponse(this.errcode, this.message, this.result);

  int errcode;
  String message;
  T result;

  factory BaseResponse.fromJson(Map<String, dynamic> json, T Function(dynamic) fromJsonT) =>
      _$BaseResponseFromJson<T>(json, fromJsonT);

  Map<String, dynamic> toJson(Object? Function(T) toJsonT) => _$BaseResponseToJson(this, toJsonT);
}
